<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<meta charset="UTF-8">
	<link rel="shortcut icon" href="${staticServerAddress}favicon.ico">
	<link rel="stylesheet" href="css/iconfont.css">
	<link rel="stylesheet" href="css/global.css">
	<link rel="stylesheet" href="css/bootstrap.min.css">
	<link rel="stylesheet" href="css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="css/swiper.min.css">
	<link rel="stylesheet" href="css/styles.css">
	<script src="js/jquery.1.12.4.min.js" charset="UTF-8"></script>
	<script src="js/bootstrap.min.js" charset="UTF-8"></script>
	<script src="js/swiper.min.js" charset="UTF-8"></script>
	<script src="js/global.js" charset="UTF-8"></script>
	<script src="js/jquery.DJMask.2.1.1.js" charset="UTF-8"></script>
	<title>微风商城</title>
</head>
<body>
	<!-- 顶部tab -->
	<div class="tab-header">
		<div class="inner">
			<div class="pull-left">
				<div class="pull-left">嗨，欢迎来到<span class="cr">微风商城</span></div>
				<a href="toAgentLevel">网店代销</a>
				<a href="toBreezeArticle4">帮助中心</a>
			</div>
			<div class="pull-right">
				<c:choose>
				<c:when test="${isLogin==Y}">
					<a href="SignOut">注销登录</a>
				</c:when>
				<c:otherwise>
					<a href="toLogin"><span class="cr">登录</span></a>
					<a href="toLogin?p=register">注册</a>
				</c:otherwise>
			</c:choose>
				<a href="toBreezeWelcome">我的微风</a>
				<a href="lineItem">我的订单</a>
				<a href="toBreezeIntegral">积分平台</a>
			</div>
		</div>
	</div>
	<!-- 顶部标题 -->
	<div class="bgf5 clearfix">
		<div class="top-user">
			<div class="inner">
				<a class="logo" href="home"><img src="images/icons/logo.jpg" alt="微风商城" class="cover"></a>
				<div class="title">购物车</div>
			</div>
		</div>
	</div>
	<div class="content clearfix bgf5">
		<section class="user-center inner clearfix">
			<div class="user-content__box clearfix bgf">
				<div class="title">购物车-确认支付 </div>
				<div class="shop-title">收货地址</div>
				<form action="updateOrder" method="post" class="shopcart-form__box">
				<input hidden="hidden" name="userId"  value="${userId}"/>
				<input hidden="hidden" name="userBalance"  value="${orderResult.userBalance}"/>
				<input hidden="hidden" name="orderId"  value="${orderResult.bzOrder.orderId}"/>
				<input hidden="hidden" name="orderShouldPayment"  value="${orderResult.bzOrder.orderShouldPayment}"/>
					<div class="addr-radio">
					<c:forEach items="${orderResult.addressList}" var="c" varStatus="vs">
						<c:if test="${c.saAddressState=='Y'}">
							<input hidden="hidden" name="orderCurrAddress"  value="${c.saReceiveAddress}(${c.saReceiveName} 收) ${c.saReceivePhone}"/>
						</c:if>
						<div class="radio-line radio-box <c:if test="${saAddressState=='Y'}">active</c:if>">
							<label class="radio-label ep" title="${c.saReceiveAddress}(${c.saReceiveName} 收) ${c.saReceivePhone}">
								<input name="addr" checked="" value="${c.saReceiveAddress}(${c.saReceiveName} 收) ${c.saReceivePhone}" autocomplete="off" type="radio"><i class="iconfont icon-radio"></i>
								${c.saReceiveAddress}(${c.saReceiveName} 收) ${c.saReceivePhone}
							</label>
								<input hidden="hidden" name="saId" value="${c.saId}"/>
							<c:choose>
								<c:when test="${c.saAddressState=='Y'}">
									<a href="javascript:;" class="default defAddress">默认地址</a>
								</c:when>
								<c:otherwise>
									<a href="javascript:;" class="default setAddress">设为默认地址</a>
								</c:otherwise>
							</c:choose>
							<a href="shippingAddress" class="edit">修改</a>
						</div>
					</c:forEach>
					<script type="text/javascript">
						$(".radio-line").click(function(){
							var Address = $(this).find("[name=addr]").val();
							var aa=$("[name=orderCurrAddress]").val();
							$("[name=orderCurrAddress]").val(Address);
						});
						$(".setAddress").click(function(){
						var saId = $(this).parent().find('[name=saId]').val();
						var saIdDefault = $(".defAddress").parent().find("[name=saId]").val();
						console.log(saId);
						console.log(saIdDefault);
							$.ajax("setDefaultAddress",{
								dataType:"json",
								data:{"saId":saId,"saIdDefault":saIdDefault},
								type:"post",
								success:function(result){
									var setAddress = $('<a href="" class="default setAddr">设为默认地址</a>');
									$("default addr").after(setAddress);
									$("default addr").remove();
									var defaultAddress = $('<a href="javascript:;" class="default addr">默认地址</a>');
									$(this).before(defaultAddress);
									$(this).remove();
									
								},
								error:function(xhr,e){
									console.error(e);
								}
							});
						});
					</script>
					</div>
					<div class="add_addr"><a href="shippingAddress">添加新地址</a></div>
					<div class="shop-title">确认订单</div>
					<div class="shop-order__detail">
						<table class="table">
							<thead>
								<tr>
									<th width="120"></th>
									<th width="300">商品信息</th>
									<th width="150">单价</th>
									<th width="200">数量</th>
									<th width="200">运费</th>
									<th width="80">总价</th>
								</tr>
							</thead>
							<tbody>
							<c:forEach items="${orderResult.productList}" var="c">
								<tr>
									<th scope="row"><a href="item_show.html"><div class="img"><img src="${staticServerAddress }${c.bookMainImg }" alt="" class="cover"></div></a></th>
									<td>
										<div class="name ep3">${c.productName}</div>
										<div class="type c9">类型:${c.productFirstType}-${c.productSencondType}-${c.productThreeType}</div>
									</td>
									<td>¥${c.productPrice}</td>
									<td>${c.scProductNum}</td>
									<td>¥0.0</td>
									<td>¥${c.productPrice*c.scProductNum}</td>
								</tr>
							</c:forEach>
							</tbody>
						</table>
					</div>
					<div class="shop-cart__info clearfix">
						<div class="pull-left text-left">
							<div class="info-line text-nowrap">交易类型：<span class="c6">担保交易</span></div>
							<div class="info-line text-nowrap">交易号：<span class="c6">${orderResult.bzOrder.orderNumber}</span></div>
						</div>
						<div class="pull-right text-right">
							<div class="form-group">
								<label for="coupon" class="control-label">优惠券使用：</label>
								<select id="coupon" >
									<option value="-1" selected>- 请选择可使用的优惠券 -</option>
									<option value="1">【满￥20.0元减￥2.0】</option>
									<option value="2">【满￥30.0元减￥2.0】</option>
									<option value="3">【满￥25.0元减￥1.0】</option>
									<option value="4">【满￥10.0元减￥1.5】</option>
									<option value="5">【满￥15.0元减￥1.5】</option>
									<option value="6">【满￥20.0元减￥1.0】</option>
								</select>
							</div>
							<script>
								$('#coupon').bind('change',function() {
									console.log($(this).val());
								})
							</script>
							<div class="info-line">优惠活动：<span class="c6">无</span></div>
							<div class="info-line">运费：<span class="c6">¥0.00</span></div>
							<div class="info-line"><span class="favour-value hidden">已优惠 ¥2.0</span>合计：<b class="fz18 cr">¥${orderResult.bzOrder.orderShouldPayment}</b></div>
							<div class="info-line fz12 c9">（可获 <span class="c6">20</span> 积分）</div>
						</div>
					</div>
					<div class="shop-title">确认订单</div>
					<input hidden="hidden" name="userBalance"  value="${orderResult.userBalance}"/>
					<input hidden="hidden" name="orderRealPayment"  value="${orderResult.bzOrder.orderShouldPayment}"/>
					<div class="pay-mode__box">
						<div class="radio-line radio-box">
							<label class="radio-label ep">
								<input name="pay-mode" value="1" autocomplete="off" type="radio"><i class="iconfont icon-radio"></i>
								<span class="fz16">余额支付</span><span class="fz14">（可用余额：¥${orderResult.userBalance}）</span>
							</label>
							<div class="pay-value">支付<b class="fz16 cr">${orderResult.bzOrder.orderShouldPayment}</b>元</div>
						</div>
						<div class="radio-line radio-box">
							<label class="radio-label ep">
								<input name="pay-mode" value="2" autocomplete="off" type="radio"><i class="iconfont icon-radio"></i>
								<img src="images/icons/alipay.png" alt="支付宝支付">
							</label>
							<div class="pay-value">支付<b class="fz16 cr">${orderResult.bzOrder.orderShouldPayment}</b>元</div>
						</div>
						<div class="radio-line radio-box">
							<label class="radio-label ep">
								<input name="pay-mode" value="3" autocomplete="off" type="radio"><i class="iconfont icon-radio"></i>
								<img src="images/icons/paywechat.png" alt="微信支付">
							</label>
							<div class="pay-value">支付<b class="fz16 cr">${orderResult.bzOrder.orderShouldPayment}</b>元</div>
						</div>
					</div>
					<div class="user-form-group shopcart-submit">
						<button class="btn">继续支付</button>
					</div>
					<script>
						$(".btn").click(function(){
							var userBalance = $("[name=userBalance]").val();
							var orderRealPayment = $("[name=orderRealPayment]").val();
							
							if(number(userBalance)<number(orderRealPayment)){
								if (confirm("您的余额不足请充值,是否前往前往充值,点击确定前往充值页面")){  
								    window.location.href="toMoneyManage" 
								    window.event.returnValue=false;
							 	}else{
									window.location.href="home"
									window.event.returnValue=false;
								 }
							}else{
								$(this).submit();
							}
						});
						$(document).ready(function(){
							$(this).on('change','input',function() {
								$(this).parents('.radio-box').addClass('active').siblings().removeClass('active');
							})
						});
					</script>
				</form>
			</div>
		</section>
	</div>
	<!-- 右侧菜单 -->
	<div class="right-nav">
		<ul class="r-with-gotop">
			<li class="r-toolbar-item">
				<a href="toBreezeWelcome" class="r-item-hd">
					<i class="iconfont icon-user" ></i>
					<div class="r-tip__box"><span class="r-tip-text">用户中心</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="toBreezeShopcart" class="r-item-hd">
					<i class="iconfont icon-cart" data-badge="${shoppingCartNum==null?0:shoppingCartNum }"></i>
					<div class="r-tip__box"><span class="r-tip-text">购物车</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="toFavorite?pageIdx=1" class="r-item-hd">
					<i class="iconfont icon-aixin"></i>
					<div class="r-tip__box"><span class="r-tip-text">我的收藏</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="#" class="r-item-hd">
					<i class="iconfont icon-liaotian"></i>
					<div class="r-tip__box"><span class="r-tip-text">联系客服</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="toIssues" class="r-item-hd">
					<i class="iconfont icon-liuyan"></i>
					<div class="r-tip__box"><span class="r-tip-text">留言反馈</span></div>
				</a>
			</li>
			<li class="r-toolbar-item to-top">
				<i class="iconfont icon-top"></i>
				<div class="r-tip__box"><span class="r-tip-text">返回顶部</span></div>
			</li>
		</ul>
		<script>
			$(document).ready(function(){ $('.to-top').toTop({position:false}) });
		</script>
	</div>
	<!-- 底部信息 -->
	<div class="footer">
		<div class="footer-tags">
			<div class="tags-box inner">
				<div class="tag-div">
					<img src="images/icons/footer_1.gif" alt="厂家直供">
				</div>
				<div class="tag-div">
					<img src="images/icons/footer_2.gif" alt="一件代发">
				</div>
				<div class="tag-div">
					<img src="images/icons/footer_3.gif" alt="美工活动支持">
				</div>
				<div class="tag-div">
					<img src="images/icons/footer_4.gif" alt="信誉认证">
				</div>
			</div>
		</div>
		<div class="footer-links inner">
			<dl>
				<dt>微风网</dt>
				<a href="toBreezeArticle10"><dd>企业简介</dd></a>
				<a href="toBreezeArticle11"><dd>加入微风</dd></a>
				<a href="toBreezeArticle12"><dd>隐私说明</dd></a>
			</dl>
			<dl>
				<dt>服务中心</dt>
				<a href="toBreezeArticle1"><dd>售后服务</dd></a>
				<a href="toBreezeArticle2"><dd>配送服务</dd></a>
				<a href="toBreezeArticle3"><dd>用户协议</dd></a>
				<a href="toBreezeArticle4"><dd>常见问题</dd></a>
			</dl>
			<dl>
				<dt>新手上路</dt>
				<a href="toBreezeArticle5"><dd>如何成为代理商</dd></a>
				<a href="toBreezeArticle6"><dd>代销商上架教程</dd></a>
				<a href="toBreezeArticle7"><dd>分销商常见问题</dd></a>
				<a href="toBreezeArticle8"><dd>付款账户</dd></a>
			</dl>
		</div>
		<div class="copy-box clearfix">
			<ul class="copy-links">
				<a href="toAgentLevel"><li>网店代销</li></a>
				<a href="toClassRoom"><li>微风学堂</li></a>
				<a href="toBreezeAbout"><li>联系我们</li></a>
				<a href="toBreezeArticle10"><li>企业简介</li></a>
				<a href="toBreezeArticle5"><li>新手上路</li></a>
			</ul>
			<!-- 版权 -->
			<p class="copyright">
				© 2018-2020 微风网 版权所有，并保留所有权利<br>
				ICP备案证书号：渝ICP备20181806号-2&nbsp;&nbsp;&nbsp;&nbsp;重庆市沙坪坝区微电子产业园区&nbsp;&nbsp;&nbsp;&nbsp;Tel: 15881909100&nbsp;&nbsp;&nbsp;&nbsp;E-mail: 15881909100@qq.com
			</p>
		</div>
	</div>
</body>
</html>